<template>
    <right class="questionnaire">
      <template slot="card">
        <CardGroup></CardGroup>
      </template>
      <template slot="detail">
        <transition name="fade" mode="out-in">
          <keep-alive>
            <router-view></router-view>
          </keep-alive>
        </transition>
      </template>
    </right>
</template>
<script>
  import right from '@/components/ui-modules/right-layout/RightLayout'
  import CardGroup from './QuestionCardGroup.vue'
  export default {
    name: 'questionnaire',
    components: {
      right,
      CardGroup
    },
    beforeRouteLeave (to, from, next) {
      this.currentRoute = from.fullPath
      next()
    },
    beforeRouteEnter (to, from, next) {
      next(vm => {
        if (to.query.active) {
        } else if (vm.currentRoute) {
          vm.$router.push({path: vm.currentRoute})
        }
      })
    }
  }
</script>
<style lang="stylus" scoped>
  .questionnaire
    height: calc(100vh - 53px);
</style>
